file handling in c in one shot